From: Kenichi Handa Date: Tue, 16 Jun 2009 01:59:44 +0000 (+0000) Subject: (detect_coding_utf_16): Fix previous change. X-Git-Tag: archive/raspbian/1%29.2+1-2+rpi1~1^2~421^2~372 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=93f63fb99cbbfd443d956286144d9fcc7392763e;p=emacs.git (detect_coding_utf_16): Fix previous change. --- diff --git a/src/coding.c b/src/coding.c index 8d90297db0f..cde56d9af42 100644 --- a/src/coding.c +++ b/src/coding.c @@ -1665,10 +1665,11 @@ detect_coding_utf_16 (coding, detect_info) e[c1] = 1; o[c2] = 1; - detect_info->rejected - |= (CATEGORY_MASK_UTF_16_BE | CATEGORY_MASK_UTF_16_LE); + detect_info->rejected |= (CATEGORY_MASK_UTF_16_AUTO + |CATEGORY_MASK_UTF_16_BE + | CATEGORY_MASK_UTF_16_LE); - while (1) + while (detect_info->rejected != CATEGORY_MASK_UTF_16) { TWO_MORE_BYTES (c1, c2); if (c2 < 0) @@ -1677,18 +1678,17 @@ detect_coding_utf_16 (coding, detect_info) { e[c1] = 1; e_num++; - if (e_num >= 128 && o_num >= 128) - break; + if (e_num >= 128) + detect_info->rejected |= CATEGORY_MASK_UTF_16_BE_NOSIG; } if (! o[c2]) { o[c2] = 1; o_num++; - if (e_num >= 128 && o_num >= 128) - break; + if (o_num >= 128) + detect_info->rejected |= CATEGORY_MASK_UTF_16_LE_NOSIG; } } - detect_info->rejected |= CATEGORY_MASK_UTF_16; return 0; }